/**
package com.gsww.vue.controller.sys;

import java.awt.image.BufferedImage;
import java.io.File;
import java.util.List;
import java.util.Map;

import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.google.code.kaptcha.Constants;
import com.google.code.kaptcha.Producer;
import com.gsww.vue.service.sys.SysAccountService;



@RestController
@RequestMapping("/kaptcha")
public class CaptchaController {
	@Autowired
	private Producer captchaProducer = null;
	@Autowired
	private SysAccountService sysAccountService;
	@RequestMapping(value = "/image", method = RequestMethod.GET)
	public void getKaptchaImage(HttpServletRequest request, HttpServletResponse response) throws Exception {
		HttpSession session = request.getSession();		
		response.setDateHeader("Expires", 0);
		
		// Set standard HTTP/1.1 no-cache headers.
		response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		
		// Set IE extended HTTP/1.1 no-cache headers (use addHeader).
		response.addHeader("Cache-Control", "post-check=0, pre-check=0");
		
		// Set standard HTTP/1.0 no-cache header.
		response.setHeader("Pragma", "no-cache");
		
		// return a jpeg
		response.setContentType("image/jpeg");
		
		// create the text for the image
		String capText = captchaProducer.createText();
		
		// store the text in the session
		session.setAttribute(Constants.KAPTCHA_SESSION_KEY, capText);
		
		// create the image with the text
		BufferedImage bi = captchaProducer.createImage(capText);
		ServletOutputStream out = response.getOutputStream();
		
		// write the data out
		ImageIO.write(bi, "JPEG", out);
		try {
			out.flush();
		} finally {
			out.close();
		}
	}
	
	@RequestMapping(value = "/image2", method = RequestMethod.GET)
	public void getImage(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String pkId = request.getParameter("pkId");
		response.setDateHeader("Expires", 0);
		
		response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		
		response.addHeader("Cache-Control", "post-check=0, pre-check=0");
		
		response.setHeader("Pragma", "no-cache");
		
		response.setContentType("image/jpeg");
		// create the image with the text
		BufferedImage bi = ImageIO.read(new File("f:/00desktop/a1.png"));
		if("2".equals(pkId)){
			bi = ImageIO.read(new File("f:/00desktop/a2.png"));
		}
		ServletOutputStream out = response.getOutputStream();
		
		// write the data out
		ImageIO.write(bi, "JPEG", out);
		try {
			out.flush();
		} finally {
			out.close();
		}
	}
	@RequestMapping(value = "/html", method = RequestMethod.GET)
	public String getText(HttpServletRequest request, HttpServletResponse response){
		String str = "";
		try {
			List<Map<String,Object>> list = sysAccountService.getHtml("1");
			if(!list.isEmpty()) {
				str = list.get(0).get("HTML").toString();
			}
		} catch(Exception e) {
			e.printStackTrace();
		}
		return str;
	}
	@RequestMapping(value = "/html2", method = RequestMethod.GET)
	public String getText2(HttpServletRequest request, HttpServletResponse response){
		String str = "";
		try {
			List<Map<String,Object>> list = sysAccountService.getHtml("2");
			if(!list.isEmpty()) {
				System.out.println(list.get(0).get("HTML").toString());
				str = list.get(0).get("HTML").toString().replace("\"动画工厂\"", "\"王八羔子\"");
				System.out.println(str);
			}
		} catch(Exception e) {
			e.printStackTrace();
		}
		return str;
	}
	public static void main(String args[]){
	}
}
*/
